<?php

$redis = new Redis();
$redis->connect('127.0.0.1');

$redis->del('zset1');

$redis->zAdd('zset1', 100, 'xiaoming'); // rank : 2
$redis->zAdd('zset1', 90, 'xiaohong'); // rank : 0
$redis->zAdd('zset1', 93, 'xiaowang'); // rank : 1

$val = $redis->zRange('zset1', 0, -1);  // 从低到高
print_r($val);  // Array ( [0] => xiaohong [1] => xiaowang [2] => xiaoming )

echo '<br>';

$val = $redis->zRevRange('zset1', 0, -1);  // 从高到低
print_r($val);  // Array ( [0] => xiaoming [1] => xiaowang [2] => xiaohong )